home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / TextUtils.a < prev    next >
Text File  |  1996-05-01  |  10KB  |  416 lines

  1. ;
  2. ;    File:        TextUtils.a
  3. ;
  4. ;    Contains:    Text Utilities Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.0 through System 8
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18.     IF &TYPE('__TEXTUTILS__') = 'UNDEFINED' THEN
  19. __TEXTUTILS__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.     IF &TYPE('__SCRIPT__') = 'UNDEFINED' THEN
  25.     include 'Script.a'
  26.     ENDIF
  27.     IF &TYPE('__OSUTILS__') = 'UNDEFINED' THEN
  28.     include 'OSUtils.a'
  29.     ENDIF
  30.     IF &TYPE('__TEXTOBJECTS__') = 'UNDEFINED' THEN
  31.     include 'TextObjects.a'
  32.     ENDIF
  33.     IF &TYPE('__NUMBERFORMATTING__') = 'UNDEFINED' THEN
  34.     include 'NumberFormatting.a'
  35.     ENDIF
  36.     IF &TYPE('__TIMEOBJECTS__') = 'UNDEFINED' THEN
  37.     include 'TimeObjects.a'
  38.     ENDIF
  39.     IF &TYPE('__STRINGCOMPARE__') = 'UNDEFINED' THEN
  40.     include 'StringCompare.a'
  41.     ENDIF
  42. ;
  43. ;
  44. ;    Here are the current System 7 routine names and the translations to the older forms.
  45. ;    Please use the newer forms in all new code and migrate the older names out of existing
  46. ;    code as maintainance permits.
  47. ;    
  48. ;    NEW NAME                    OLD NAMEs                    OBSOLETE FORM (no script code)
  49. ;
  50. ;    FindScriptRun
  51. ;    FindWordBreaks                                            NFindWord, FindWord
  52. ;    GetIndString            
  53. ;    GetString
  54. ;    Munger
  55. ;    NewString                
  56. ;    SetString                
  57. ;    StyledLineBreak
  58. ;    TruncString
  59. ;    TruncText
  60. ;
  61. ;    UpperString ($A054)            UprString, UprText
  62. ;    UppercaseText                SCUpperText (a only)        UpperText ($A456)
  63. ;    LowercaseText                                            LwrString, LowerText, LwrText ($A056)
  64. ;    StripDiacritics                                            StripText ($A256)
  65. ;    UppercaseStripDiacritics                                StripUpperText ($A656)
  66. ;
  67. ;
  68. ;
  69.     IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
  70. ;  Type for truncWhere parameter in TruncString, TruncText 
  71. ; typedef short                         TruncCode
  72.  
  73.  
  74.                                                             ; Constants for truncWhere argument in TruncString and TruncText 
  75. truncEnd                        EQU        0                    ; Truncate at end 
  76. truncMiddle                        EQU        $4000                ; Truncate in middle 
  77. smTruncEnd                        EQU        0                    ; Truncate at end - obsolete 
  78. smTruncMiddle                    EQU        $4000                ; Truncate in middle - obsolete 
  79.                                                             ; Constants for TruncString and TruncText results 
  80. notTruncated                    EQU        0                    ; No truncation was necessary 
  81. truncated                        EQU        1                    ; Truncation performed 
  82. truncErr                        EQU        -1                    ; General error 
  83. smNotTruncated                    EQU        0                    ; No truncation was necessary - obsolete 
  84. smTruncated                        EQU        1                    ; Truncation performed    - obsolete 
  85. smTruncErr                        EQU        -1                    ; General error - obsolete 
  86. ; typedef SInt8                         StyledLineBreakCode
  87.  
  88.  
  89. smBreakWord                        EQU        0
  90. smBreakChar                        EQU        1
  91. smBreakOverflow                    EQU        2
  92. ScriptRunStatus            RECORD 0
  93. script                     ds.b    1                ; offset: $0 (0)
  94. runVariant                 ds.b    1                ; offset: $1 (1)
  95. sizeof                     EQU *                    ; size:   $2 (2)
  96.                         ENDR
  97. BreakTable                RECORD 0
  98. charTypes                 ds.b    256                ; offset: $0 (0)
  99. tripleLength             ds.w    1                ; offset: $100 (256)
  100. triples                     ds.w    1                ; offset: $102 (258) <-- really an array of length one
  101. sizeof                     EQU *                    ; size:   $104 (260)
  102.                         ENDR
  103. ; typedef struct BreakTable *            BreakTablePtr
  104.  
  105. NBreakTable                RECORD 0
  106. flags1                     ds.b    1                ; offset: $0 (0)
  107. flags2                     ds.b    1                ; offset: $1 (1)
  108. version                     ds.w    1                ; offset: $2 (2)
  109. classTableOff             ds.w    1                ; offset: $4 (4)
  110. auxCTableOff             ds.w    1                ; offset: $6 (6)
  111. backwdTableOff             ds.w    1                ; offset: $8 (8)
  112. forwdTableOff             ds.w    1                ; offset: $A (10)
  113. doBackup                 ds.w    1                ; offset: $C (12)
  114. length                     ds.w    1                ; offset: $E (14)        ;  length of NBreakTable 
  115. charTypes                 ds.b    256                ; offset: $10 (16)
  116. tables                     ds.w    1                ; offset: $110 (272) <-- really an array of length one
  117. sizeof                     EQU *                    ; size:   $112 (274)
  118.                         ENDR
  119. ; typedef struct NBreakTable *            NBreakTablePtr
  120.  
  121. ;  The following functions are new names that work on 68k and PowerPC 
  122. ;
  123. ; pascal long Munger(Handle h, long offset, const void *ptr1, long len1, const void *ptr2, long len2)
  124. ;
  125.     IF ¨ GENERATINGCFM THEN
  126.         _Munger:    OPWORD    $A9E0
  127.     ELSE
  128.         IMPORT_CFM_FUNCTION Munger
  129.     ENDIF
  130.  
  131. ;
  132. ; pascal StringHandle NewString(ConstStr255Param theString)
  133. ;
  134.     IF ¨ GENERATINGCFM THEN
  135.         _NewString:    OPWORD    $A906
  136.     ELSE
  137.         IMPORT_CFM_FUNCTION NewString
  138.     ENDIF
  139.  
  140. ;
  141. ; pascal void SetString(StringHandle theString, ConstStr255Param strNew)
  142. ;
  143.     IF ¨ GENERATINGCFM THEN
  144.         _SetString:    OPWORD    $A907
  145.     ELSE
  146.         IMPORT_CFM_FUNCTION SetString
  147.     ENDIF
  148.  
  149. ;
  150. ; pascal StringHandle GetString(short stringID)
  151. ;
  152.     IF ¨ GENERATINGCFM THEN
  153.         _GetString:    OPWORD    $A9BA
  154.     ELSE
  155.         IMPORT_CFM_FUNCTION GetString
  156.     ENDIF
  157.  
  158. ;
  159. ; pascal StyledLineBreakCode StyledLineBreak(Ptr textPtr, long textLen, long textStart, long textEnd, long flags, Fixed *textWidth, long *textOffset)
  160. ;
  161.     IF ¨ GENERATINGCFM THEN
  162.         Macro
  163.         _StyledLineBreak
  164.             move.l              #$821CFFFE,-(sp)
  165.             dc.w                $A8B5
  166.         EndM
  167.     ELSE
  168.         IMPORT_CFM_FUNCTION StyledLineBreak
  169.     ENDIF
  170.  
  171. ;
  172. ; pascal short TruncString(short width, Str255 theString, TruncCode truncWhere)
  173. ;
  174.     IF ¨ GENERATINGCFM THEN
  175.         Macro
  176.         _TruncString
  177.             move.l              #$8208FFE0,-(sp)
  178.             dc.w                $A8B5
  179.         EndM
  180.     ELSE
  181.         IMPORT_CFM_FUNCTION TruncString
  182.     ENDIF
  183.  
  184. ;
  185. ; pascal short TruncText(short width, Ptr textPtr, short *length, TruncCode truncWhere)
  186. ;
  187.     IF ¨ GENERATINGCFM THEN
  188.         Macro
  189.         _TruncText
  190.             move.l              #$820CFFDE,-(sp)
  191.             dc.w                $A8B5
  192.         EndM
  193.     ELSE
  194.         IMPORT_CFM_FUNCTION TruncText
  195.     ENDIF
  196.  
  197. ;
  198. ; pascal void FindWordBreaks(Ptr textPtr, short textLength, short offset, Boolean leadingEdge, BreakTablePtr breaks, OffsetTable offsets, ScriptCode script)
  199. ;
  200.     IF ¨ GENERATINGCFM THEN
  201.         Macro
  202.         _FindWordBreaks
  203.             move.l              #$C012001A,-(sp)
  204.             dc.w                $A8B5
  205.         EndM
  206.     ELSE
  207.         IMPORT_CFM_FUNCTION FindWordBreaks
  208.     ENDIF
  209.  
  210. ;
  211. ; pascal void LowercaseText(Ptr textPtr, short len, ScriptCode script)
  212. ;
  213.     IF ¨ GENERATINGCFM THEN
  214.         Macro
  215.         _LowercaseText
  216.             move.w              #$0000,-(sp)
  217.             move.l              #$800AFFB6,-(sp)
  218.             dc.w                $A8B5
  219.         EndM
  220.     ELSE
  221.         IMPORT_CFM_FUNCTION LowercaseText
  222.     ENDIF
  223.  
  224. ;
  225. ; pascal void UppercaseText(Ptr textPtr, short len, ScriptCode script)
  226. ;
  227.     IF ¨ GENERATINGCFM THEN
  228.         Macro
  229.         _UppercaseText
  230.             move.w              #$0400,-(sp)
  231.             move.l              #$800AFFB6,-(sp)
  232.             dc.w                $A8B5
  233.         EndM
  234.     ELSE
  235.         IMPORT_CFM_FUNCTION UppercaseText
  236.     ENDIF
  237.  
  238. ;
  239. ; pascal void StripDiacritics(Ptr textPtr, short len, ScriptCode script)
  240. ;
  241.     IF ¨ GENERATINGCFM THEN
  242.         Macro
  243.         _StripDiacritics
  244.             move.w              #$0200,-(sp)
  245.             move.l              #$800AFFB6,-(sp)
  246.             dc.w                $A8B5
  247.         EndM
  248.     ELSE
  249.         IMPORT_CFM_FUNCTION StripDiacritics
  250.     ENDIF
  251.  
  252. ;
  253. ; pascal void UppercaseStripDiacritics(Ptr textPtr, short len, ScriptCode script)
  254. ;
  255.     IF ¨ GENERATINGCFM THEN
  256.         Macro
  257.         _UppercaseStripDiacritics
  258.             move.w              #$0600,-(sp)
  259.             move.l              #$800AFFB6,-(sp)
  260.             dc.w                $A8B5
  261.         EndM
  262.     ELSE
  263.         IMPORT_CFM_FUNCTION UppercaseStripDiacritics
  264.     ENDIF
  265.  
  266. ;
  267. ; pascal ScriptRunStatus FindScriptRun(Ptr textPtr, long textLen, long *lenUsed)
  268. ;
  269.     IF ¨ GENERATINGCFM THEN
  270.         Macro
  271.         _FindScriptRun
  272.             move.l              #$820C0026,-(sp)
  273.             dc.w                $A8B5
  274.         EndM
  275.     ELSE
  276.         IMPORT_CFM_FUNCTION FindScriptRun
  277.     ENDIF
  278.  
  279.     ENDIF
  280. ;  FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  281.     IF FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE THEN
  282. ;
  283. ; pascal void UpperString(Str255 theString, Boolean diacSensitive)
  284. ;
  285.     IF ¨ GENERATINGCFM THEN
  286.         _UpperString:    OPWORD    $A054
  287.     ELSE
  288.         IMPORT_CFM_FUNCTION UpperString
  289.     ENDIF
  290.  
  291. ;
  292. ; pascal void UpperStringMarks(Str255 theString)
  293. ;
  294.     IF ¨ GENERATINGCFM THEN
  295.         _UpperStringMarks:    OPWORD    $A254
  296.     ELSE
  297.         IMPORT_CFM_FUNCTION UpperStringMarks
  298.     ENDIF
  299.  
  300. ;  Old routine name but no new names are mapped to it:
  301. ;
  302. ; pascal void UprText(Ptr textPtr, short len)
  303. ;
  304.     IF ¨ GENERATINGCFM THEN
  305.         ; parameters:
  306.         ;    textPtr         => A0
  307.         ;    len             => D0
  308.         _UprText:    OPWORD    $A054
  309.     ELSE
  310.         IMPORT_CFM_FUNCTION UprText
  311.     ENDIF
  312.  
  313.     ENDIF
  314. ;  FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE
  315. ;
  316. ;    The following functions are old names, but are required for PowerPC builds
  317. ;    because InterfaceLib exports these names, instead of the new ones.
  318. ;
  319.     IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
  320. ;
  321. ; pascal void FindWord(Ptr textPtr, short textLength, short offset, Boolean leadingEdge, BreakTablePtr breaks, OffsetTable offsets)
  322. ;
  323.     IF ¨ GENERATINGCFM THEN
  324.         Macro
  325.         _FindWord
  326.             move.l              #$8012001A,-(sp)
  327.             dc.w                $A8B5
  328.         EndM
  329.     ELSE
  330.         IMPORT_CFM_FUNCTION FindWord
  331.     ENDIF
  332.  
  333. ;
  334. ; pascal void NFindWord(Ptr textPtr, short textLength, short offset, Boolean leadingEdge, NBreakTablePtr nbreaks, OffsetTable offsets)
  335. ;
  336.     IF ¨ GENERATINGCFM THEN
  337.         Macro
  338.         _NFindWord
  339.             move.l              #$8012FFE2,-(sp)
  340.             dc.w                $A8B5
  341.         EndM
  342.     ELSE
  343.         IMPORT_CFM_FUNCTION NFindWord
  344.     ENDIF
  345.  
  346. ;
  347. ; pascal void LwrText(Ptr textPtr, short len)
  348. ;
  349.     IF ¨ GENERATINGCFM THEN
  350.         ; parameters:
  351.         ;    textPtr         => A0
  352.         ;    len             => D0
  353.         _LwrText:    OPWORD    $A056
  354.     ELSE
  355.         IMPORT_CFM_FUNCTION LwrText
  356.     ENDIF
  357.  
  358. ;
  359. ; pascal void LowerText(Ptr textPtr, short len)
  360. ;
  361.     IF ¨ GENERATINGCFM THEN
  362.         ; parameters:
  363.         ;    textPtr         => A0
  364.         ;    len             => D0
  365.         _LowerText:    OPWORD    $A056
  366.     ELSE
  367.         IMPORT_CFM_FUNCTION LowerText
  368.     ENDIF
  369.  
  370. ;
  371. ; pascal void StripText(Ptr textPtr, short len)
  372. ;
  373.     IF ¨ GENERATINGCFM THEN
  374.         ; parameters:
  375.         ;    textPtr         => A0
  376.         ;    len             => D0
  377.         _StripText:    OPWORD    $A256
  378.     ELSE
  379.         IMPORT_CFM_FUNCTION StripText
  380.     ENDIF
  381.  
  382. ;
  383. ; pascal void UpperText(Ptr textPtr, short len)
  384. ;
  385.     IF ¨ GENERATINGCFM THEN
  386.         ; parameters:
  387.         ;    textPtr         => A0
  388.         ;    len             => D0
  389.         _UpperText:    OPWORD    $A456
  390.     ELSE
  391.         IMPORT_CFM_FUNCTION UpperText
  392.     ENDIF
  393.  
  394. ;
  395. ; pascal void StripUpperText(Ptr textPtr, short len)
  396. ;
  397.     IF ¨ GENERATINGCFM THEN
  398.         ; parameters:
  399.         ;    textPtr         => A0
  400.         ;    len             => D0
  401.         _StripUpperText:    OPWORD    $A656
  402.     ELSE
  403.         IMPORT_CFM_FUNCTION StripUpperText
  404.     ENDIF
  405.  
  406.     ENDIF
  407. ;  FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  408.     IF ¨ OLDROUTINELOCATIONS THEN
  409.     IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
  410.     ENDIF
  411. ;  FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE
  412.     ENDIF
  413. ;  !OLDROUTINELOCATIONS
  414.     ENDIF ; __TEXTUTILS__ 
  415.  
  416.